<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>


<s:if test="customer==null || editId == null">
	<s:set name="title" value="Add a new customer"/>
</s:if>
<s:else>
	<s:set name="title" value="Change customer"/>
</s:else>

<html>
<head>
    <link href="<s:url value='/css/main.css'/>" rel="stylesheet" type="text/css"/>
    <style>td { white-space:nowrap; }</style>
    <title><s:property value="#title"/></title>
</head>
<body>
<div class="titleDiv"><s:text name="application.title"/></div>
<h1><s:property value="#title"/></h1>
<s:actionerror />
<s:actionmessage />
<s:form action="Customerrepository!save.action">
    <s:textfield name="Name" value="%{customer.name}" label="%{getText('label.customer.name')}" size="40"/>
    <s:textfield name="Street" value="%{customer.Street}" label="%{getText('label.customer.street')}" size="40"/>
    <s:textfield name="Number" value="%{customer.Number}" label="%{getText('label.customer.number')}" size="10"/>
    <s:textfield name="Mailbox" value="%{customer.Mailbox}" label="%{getText('label.customer.mailbox')}" size="6"/>
    <s:textfield name="Postalcode" value="%{customer.PostalCode}" label="%{getText('label.customer.postalcode')}" size="8"/>
    <s:textfield name="City" value="%{customer.City}" label="%{getText('label.customer.city')}" size="40"/>
    <s:textfield name="Telephone" value="%{customer.Telephone}" label="%{getText('label.customer.telephone')}" size="40"/>
    <s:textfield name="Email" value="%{customer.Email}" label="%{getText('label.customer.email')}" size="40"/>
    <s:textfield name="IBAN" value="%{customer.Iban}" label="%{getText('label.customer.iban')}" size="40"/>
    <s:textfield name="BIC" value="%{customer.Bic}" label="%{getText('label.customer.bic')}" size="40"/>
    <s:select name="categoryCode" value="%{customer.CategoryCode}" list="typesCat" label="%{getText('label.customer.categorycode')}"/>
    <s:select name="typeCode" value="%{customer.TypeCode}" list="typesCode" label="%{getText('label.customer.typecode')}"/>
    <s:select name="active" value="%{customer.active}" list="states" label="%{getText('label.customer.active')}"/>
    <s:hidden name="editId" value="%{customer.customerId}"/>
    <s:submit value="%{getText('button.label.submit')}"/>
</s:form>
<s:url action="Customerindex!list" id="listurl"></s:url>
<a href="<s:property value="#listurl"/>">Back to Customer list</a>
</body>
</html>